package com.sskj.api.domain;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.NotNull;
import lombok.Data;
import java.time.LocalDateTime;
import java.util.List;

@Schema(description = "产品表")
@Data
@TableName("product")
public class Product {

    @Schema(description = "主键ID")
    @TableId(type = IdType.ASSIGN_ID)
    private Long id;

    @Schema(description = "名称")
    @NotBlank(message = "名称不能为空")
    private String name;

    @Schema(description = "图标")
    private String icon;

    @Schema(description = "分类ID")
    @TableField("category_id")
    @NotNull(message = "所属分类不能为空")
    private Long categoryId;

    @Schema(description = "分类名称")
    @TableField(exist = false)
    private String categoryName;

    @Schema(description = "厂商ID")
    @TableField("manufacturer_id")
    private Long manufacturerId;

    @Schema(description = "厂商名称")
    @TableField(exist = false)
    private String manufacturerName;

    @Schema(description = "设备类型[1:直连设备|2:网关设备|3:子网关设备]")
    @TableField(exist = false)
    @NotNull(message = "设备类型不能为空")
    private Integer deviceType;

    @Schema(description = "联网模式[1:WIFI|2:蜂窝(2G/3G/4G/5G)|3:以太网|4:NB-IoT|5:蓝牙|99:其他]")
    @TableField("connectivity_mode")
    @NotNull(message = "联网模式不能为空")
    private Integer connectivityMode;

    @Schema(description = "通信协议")
    @TableField("communication_protocol_id")
    @NotNull(message = "通信协议不能为空")
    private Long communicationProtocolId;

    @Schema(description = "通信协议Code")
    @TableField(exist = false)
    private String communicationProtocolCode;

    @Schema(description = "传输协议")
    @TableField("transport_protocol")
    @NotNull(message = "传输协议不能为空")
    private Integer transportProtocol;

    @Schema(description = "产品描述")
    private Integer description;

    @Schema(description = "状态[0:禁用|1:启用]")
    private Integer status;

    @Schema(description = "能力ID集合，绑定产品能力则需要传递")
    @TableField(exist = false)
    private List<Long> capabilityIds;

    @Schema(description = "产品能力集合")
    @TableField(exist = false)
    private List<ProductCapability> productCapabilities;

    @TableField("create_time")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private LocalDateTime createTime;

    @TableField("create_time")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private LocalDateTime updateTime;
}
